﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 基础的状态类，实现了一个数值状态，并提供modify、get和set方法
/// </summary>
public class Status : MonoBehaviour
{
    public float num;
    public float min;
    public float max;

    public void PrintStatus()
    {
        Debug.Log(num);
    }

    public Status(float statusMax)
    {
        min = 0;
        max = statusMax;
        num = max;
    }

    public int BorderCheck()
    {
        if (num >= max)
        {
            num = max;
            return 2;
        }
        
        if (num <= min) 
        {
            num = min;
            return 1;
        }
        return 0;
    }


    public void Modify(float modifyNum)
    {
        num += modifyNum;
        BorderCheck();
    }

    public void Set(float setNum)
    {
        num = setNum;
        BorderCheck();
    }

    
}
